home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_libtool.idb / usr / freeware / bin / libtoolize.z / libtoolize
Encoding:
Text File  |  1999-07-16  |  7.9 KB  |  309 lines

  1. #! /bin/sh
  2. # libtoolize - Prepare a package to use libtool.
  3. # Generated automatically from libtoolize.in by configure.
  4. # Copyright (C) 1996-1999 Free Software Foundation, Inc.
  5. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. #
  21. # As a special exception to the GNU General Public License, if you
  22. # distribute this file as part of a program that contains a
  23. # configuration script generated by Autoconf, you may include it under
  24. # the same distribution terms that you use for the rest of that program.
  25.  
  26. # The name of this program.
  27. progname=`echo "$0" | sed 's%^.*/%%'`
  28.  
  29. # Constants.
  30. PROGRAM=libtoolize
  31. PACKAGE=libtool
  32. VERSION=1.3.2
  33.  
  34. # Directory names.
  35. prefix=/usr/freeware
  36. datadir=${prefix}/share
  37. pkgdatadir=${datadir}/libtool
  38. aclocaldir=${datadir}/aclocal
  39.  
  40. libtool_m4="$aclocaldir/libtool.m4"
  41.  
  42. dry_run=no
  43. help="Try \`$progname --help' for more information."
  44. rm="rm -f"
  45. ln_s="ln -s"
  46. cp="cp -f"
  47. mkdir="mkdir"
  48.  
  49. # Global variables.
  50. automake=
  51. copy=
  52. force=
  53. ltdl=
  54. ltdl_tar=
  55. status=0
  56.  
  57. for arg
  58. do
  59.   case "$arg" in
  60.   --help)
  61.     cat <<EOF
  62. Usage: $progname [OPTION]...
  63.  
  64. Prepare a package to use libtool.
  65.  
  66.     --automake        work silently, and assume that Automake is in use
  67. -c, --copy            copy files rather than symlinking them
  68.     --debug           enable verbose shell tracing
  69. -n, --dry-run         print commands rather than running them
  70. -f, --force           replace existing files
  71.     --help            display this message and exit
  72.     --ltdl            install libltdl in a subdirectory
  73.     --ltdl-tar        install the libltdl tarball
  74.     --version         print version information and exit
  75.  
  76. You must \`cd' to the top directory of your package before you run
  77. \`$progname'.
  78. EOF
  79.     exit 0
  80.     ;;
  81.  
  82.   --version)
  83.     echo "$PROGRAM (GNU $PACKAGE) $VERSION"
  84.     exit 0
  85.     ;;
  86.  
  87.   --automake)
  88.     automake=yes
  89.     ;;
  90.  
  91.   -c | --copy)
  92.     ln_s=
  93.     ;;
  94.  
  95.   --debug)
  96.     echo "$progname: enabling shell trace mode"
  97.     set -x
  98.     ;;
  99.  
  100.   -n | --dry-run)
  101.     if test "$dry_run" != yes; then
  102.       dry_run=yes
  103.       rm="echo $rm"
  104.       test -n "$ln_s" && ln_s="echo $ln_s"
  105.       cp="echo $cp"
  106.       mkdir="echo mkdir"
  107.     fi
  108.     ;;
  109.  
  110.   -f | --force)
  111.     force=yes
  112.     ;;
  113.  
  114.   --ltdl)
  115.     ltdl=yes
  116.     ;;
  117.  
  118.   --ltdl-tar)
  119.     ltdl_tar=yes
  120.     ;;
  121.  
  122.   -*)
  123.     echo "$progname: unrecognized option \`$arg'" 1>&2
  124.     echo "$help" 1>&2
  125.     exit 1
  126.     ;;
  127.  
  128.   *)
  129.     echo "$progname: too many arguments" 1>&2
  130.     echo "$help" 1>&2
  131.     exit 1
  132.     ;;
  133.   esac
  134. done
  135.  
  136. if test ! -f configure.in; then
  137.   echo "$progname: \`configure.in' does not exist" 1>&2
  138.   echo "$help" 1>&2
  139.   exit 1
  140. fi
  141.  
  142.  
  143. files=`cd $pkgdatadir && ls`
  144. if test -z "$files"; then
  145.   echo "$progname: cannot list files in \`$pkgdatadir'" 1>&2
  146.   exit 1
  147. fi
  148. files='config.guess config.sub ltconfig ltmain.sh'
  149.  
  150. auxdir=.
  151. auxdirline=`egrep '^AC_CONFIG_AUX_DIR' configure.in 2>/dev/null`
  152. if test -n "$auxdirline"; then
  153.   # Handle explicit AC_CONFIG_AUX_DIR settings.
  154.   auxdir=`echo "$auxdirline" | sed 's/^AC_CONFIG_AUX_DIR(\([^)]*\)).*$/\1/'`
  155.  
  156.   if test "$auxdir" = "$auxdirline"; then
  157.     echo "$progname: invalid AC_CONFIG_AUX_DIR syntax: $auxdirline" 1>&2
  158.     exit 1
  159.   else
  160.     # Strip any quote brackets.
  161.     auxdir=`echo "$auxdir" | sed 's/^\[\(.*\)\]$/\1/g'`
  162.     case "$auxdir" in
  163.     *\$*)
  164.       echo "$progname: cannot handle variables in AC_CONFIG_AUX_DIR" 1>&2
  165.       exit 1
  166.       ;;
  167.     *)
  168.     ;;
  169.     esac
  170.   fi
  171. else
  172.   # Try to discover auxdir the same way it is discovered by configure.
  173.   # Note that we default to the current directory.
  174.   for dir in . .. ../..; do
  175.     if test -f $dir/install-sh; then
  176.       auxdir=$dir
  177.       break
  178.     elif test -f $dir/install.sh; then
  179.       auxdir=$dir
  180.       break
  181.     fi
  182.   done
  183. fi
  184.  
  185. if test -z "$automake"; then
  186.   if egrep '^A[MC]_PROG_LIBTOOL' configure.in >/dev/null 2>&1; then :
  187.   else
  188.     echo "Remember to add \`AM_PROG_LIBTOOL' to \`configure.in'."
  189.   fi
  190.  
  191.   if egrep '^AC_PROG_RANLIB' configure.in >/dev/null 2>&1; then
  192.     echo "Using \`AC_PROG_RANLIB' is rendered obsolete by \`AM_PROG_LIBTOOL'"
  193.   fi
  194.  
  195.   if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then
  196.     updatemsg="update your \`aclocal.m4' by running aclocal"
  197.   else
  198.     updatemsg="add the contents of \`$libtool_m4' to \`aclocal.m4'"
  199.   fi
  200.  
  201.   if egrep '^AC_DEFUN\(A[MC]_PROG_LIBTOOL' aclocal.m4 >/dev/null 2>&1; then
  202.     # Check the version number on libtool.m4 and the one used in aclocal.m4.
  203.     instserial=`grep '^# serial ' $libtool_m4 | grep 'A[MC]_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
  204.  
  205.     if test -z "$instserial"; then
  206.       echo "$progname: warning: no serial number on \`$libtool_m4'" 1>&2
  207.     else
  208.       # If the local macro has no serial number, we assume it's ancient.
  209.       localserial=`grep '^# serial ' aclocal.m4 | grep 'A[MC]_PROG_LIBTOOL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'`
  210.  
  211.       test -z "$localserial" && localserial=0
  212.  
  213.       if test "$localserial" -lt "$instserial"; then
  214.     echo "You should $updatemsg."
  215.       elif test "$localserial" -gt "$instserial"; then
  216.     echo "$progname: \`$libtool_m4' is serial $instserial, less than $localserial in \`aclocal.m4'" 1>&2
  217.     if test -z "$force"; then
  218.       echo "Use \`--force' to replace newer libtool files with this version." 1>&2
  219.       exit 1
  220.     fi
  221.     echo "To remain compatible, you should $updatemsg."
  222.       fi
  223.     fi
  224.   else
  225.     echo "You should $updatemsg."
  226.   fi
  227. fi
  228.  
  229.  
  230. if test "x$ltdl" = xyes; then
  231.   test -d libltdl || $mkdir libltdl
  232.   ltdlfiles=`cd $pkgdatadir && ls libltdl/*`
  233. else
  234.   ltdlfiles=
  235. fi
  236.  
  237. for file in $ltdlfiles; do
  238.   if test -f "$file" && test -z "$force"; then
  239.     test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2
  240.     continue
  241.   fi
  242.  
  243.   $rm $file
  244.   if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then :
  245.   elif $cp $pkgdatadir/$file $file; then :
  246.   else
  247.     echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2
  248.     status=1
  249.   fi
  250. done
  251.  
  252. if test "x$ltdl_tar" = x"yes"; then
  253.   if test "x$dry_run" = x"yes"; then
  254.     echo "tar -cf - libltdl | gzip --best > libltdl.tar.gz"
  255.   elif test -f libltdl.tar.gz && test -z "$force"; then
  256.     test -z "$automake" && echo "$progname: \`libltdl.tar.gz' exists: use \`--force' to overwrite" 1>&2
  257.   else
  258.     test -d libltdl && ${rm}r libltdl
  259.     $mkdir libltdl
  260.     ltdlfiles=`cd $pkgdatadir && ls libltdl/*`
  261.     for file in $ltdlfiles; do
  262.       if $cp $pkgdatadir/$file $file; then :
  263.       else
  264.     echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2
  265.     status=1
  266.     break
  267.       fi
  268.     done
  269.     for file in $files; do
  270.       if $cp $pkgdatadir/$file libltdl/$file; then :
  271.       else
  272.     echo "$progname: cannot copy \`$pkgdatadir/$file' to \`libltdl/$file'" 1>&2
  273.     status=1
  274.     break
  275.       fi
  276.     done
  277.     tar -cf - libltdl | gzip --best > libltdl.tar.gz
  278.     ${rm}r libltdl
  279.   fi
  280. fi
  281.  
  282. # Change to the auxiliary directory.
  283. if test "$auxdir" != .; then
  284.   test -z "$automake" && echo "Putting files in AC_CONFIG_AUX_DIR, \`$auxdir'."
  285.   cd $auxdir || exit 1
  286. fi
  287.  
  288. for file in $files; do
  289.   if test -f "$file" && test -z "$force"; then
  290.     test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2
  291.     continue
  292.   fi
  293.  
  294.   $rm $file
  295.   if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then :
  296.   elif $cp $pkgdatadir/$file $file; then :
  297.   else
  298.     echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2
  299.     status=1
  300.   fi
  301. done
  302.  
  303. exit $status
  304.  
  305. # Local Variables:
  306. # mode:shell-script
  307. # sh-indentation:2
  308. # End:
  309.